package com.ztf.springsecurity.config;

import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.NoOpPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;

public class PasswordEncoderTest {
    public static void main(String[] args) {
//        PasswordEncoderTest test = new PasswordEncoderTest();
//        String str = test.encryptPassword("1234");
//        System.out.println("str="+str);
        PasswordEncoder passwordEncoder = NoOpPasswordEncoder.getInstance();
        String password = passwordEncoder.encode("1234");
        Boolean bool = passwordEncoder.matches(password, password);
        System.out.println("boot=="+bool);
    }

//    private String encryptPassword(String password) {
//        // BCryptPasswordEncoder 加密
//        //return new BCryptPasswordEncoder().encode(password);
//        return NoOpPasswordEncoder.getInstance().encode(password);
//    }

}
